projects
/
project
/
bcm63xx
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bb08a6e
)
common: env_flags: fix loop condition when using env_flags_varaccess_mask
author
Peng Fan
<
[email protected]
>
Tue, 12 Jan 2016 09:23:12 +0000
(17:23 +0800)
committer
Tom Rini
<
[email protected]
>
Thu, 14 Jan 2016 02:05:26 +0000
(21:05 -0500)
We should use ARRAY_SIZE, but not sizeof. The size of
env_flags_varaccess_mask is 16bytes, but we only need 4 loops.
If using 16 as the end condition, we may access memory that
not belong to array env_flags_varaccess_mask.
Signed-off-by: Peng Fan <
[email protected]
>
Cc: Joe Hershberger <
[email protected]
>
Cc: York Sun <
[email protected]
>
Cc: Simon Glass <
[email protected]
>
Cc: Tom Rini <
[email protected]
>
Reviewed-by: Simon Glass <
[email protected]
>
Acked-by: Joe Hershberger <
[email protected]
>
common/env_flags.c
patch
|
blob
|
history
diff --git
a/common/env_flags.c
b/common/env_flags.c
index 771935508cb352b6d4f6a9a55c8042e51ba8a749..9c3aed15278dc2fc53ba1bc8571c7da840681731 100644
(file)
--- a/
common/env_flags.c
+++ b/
common/env_flags.c
@@
-152,7
+152,7
@@
enum env_flags_varaccess env_flags_parse_varaccess_from_binflags(int binflags)
{
int i;
- for (i = 0; i <
sizeof
(env_flags_varaccess_mask); i++)
+ for (i = 0; i <
ARRAY_SIZE
(env_flags_varaccess_mask); i++)
if (env_flags_varaccess_mask[i] ==
(binflags & ENV_FLAGS_VARACCESS_BIN_MASK))
return (enum env_flags_varaccess)i;